<?php 

	/**
	 * 面向对象关键字及魔术方法
	 *
	 * instanceof
	 * 这个关键字是操作符 用于检测当前对象实力是否存在属于某一个类的类型。
	hash_final(context)
	 * 
	 */

	class Person{
		protected $name;
		protected $age;
		protected $sex;

		public function __construct($name, $age, $sex){
			$this->name = $name;
			$this->age  = $age;
			$this->sex  = $sex;
		}

		public function say(){
			echo "大家好！我的名字叫：{$this->name}，我已经{$this->age}岁了，我是{$this->sex}人";
		}

		public function eat(){
			echo "大家好！！！我叫张三";
		}

		public function run(){

		}

	}

	class Study extends Person{
		public $school = "EDU";

		public function say(){
			parent::say();
			echo "我在{$this->school}学校";
		}


	}

	class Teacher extends Study {
		public $work;

		public function dowork(){

		}
	}


	$a = new Study("Tom", 25, "女");
	$b = new Study("123", 35,12,34,34);
	

	if ($a instanceof Person) {
		echo "在类中有定义";
	}else{
		echo "没有定义！！";
	}

	echo "<hr>";

	if ($b instanceof student) {
		echo "在类中有定义";
	}else{
		echo "没有定义！！";
	}


















 ?>